home *** CD-ROM | disk | FTP | other *** search
- ;*
- ;* Routines to set up global A5 space
- ;*
- ; * Copyright (c) 1990 Regents of The University of Michigan.
- ; * All Rights Reserved.
- ; *
- ; * Permission to use, copy, modify, and distribute this software
- ; * and its documentation for any purpose and without fee is hereby
- ; * granted, provided that the above copyright notice appears in all
- ; * copies and that both that copyright notice and this permission
- ; * notice appear in supporting documentation, and that the name of
- ; * The University of Michigan not be used in advertising or
- ; * publicity pertaining to distribution of the software without
- ; * specific, written prior permission. This software is supplied as
- ; * is without expressed or implied warranties of any kind.
- ; *
- ; * ITD Research Systems
- ; * University of Michigan
- ; * 535 W. William Street
- ; * Ann Arbor, Michigan
- ; * +1-313-936-2652
- ; * netatalk@terminator.cc.umich.edu
- ; *
-
- Case OBJ
- Print OFF
- Include 'Traps.a'
- Include 'QuickEqu.a'
- Load 'ProgStrucMacs.d'
- Load 'FlowCtlMacs.d'
- Print ON
-
- Import NewPtr
- Import A5Size
- Import A5Init
- Import A5Dispose
-
- QUICKDRAW RECORD IMPORT,DECREMENT
- thePort DS.L 1
- white DS.B 8
- black DS.B 8
- gray DS.B 8
- ltGray DS.B 8
- dkGray DS.B 8
- arrow DS.B cursRec
- screenBits DS.B 14
- randSeed DS.L 1
- ENDR
-
- uam_mem dc.l 0
-
-
- export procedure myseta5
- begin Save=A0-A4/D1-D6
- jsr A5Size ; get length (in D0)
- addi.l #206,D0 ; add room below for QuickDraw globals
- move.l D0,-(SP) ; save the length
- addi.l #$20,D0 ; add room above new A5 for appl. params
- _NewPtr ; allocate new area
- cmp.l #0,A0 ; check for success
- bnz.s memok ;
- addq.l #4,SP ; clean up the stack
- move.l #-1,D0 ; return with error
- return
-
- memok
- move.l (SP)+,D0 ; retrieve the length
- move.l A1,-(SP) ; save A1
- lea uam_mem,A1 ; store ptr to our A5 memory so we can free on close
- move.l A0,(A1) ;
- add.l A0,D0 ; DO points to end of new region
- move.l D0,D5 ; save new A5 value
- move.l A5,D6 ; save old A5 value
- move.l D0,-(SP) ; build new global area
- jsr A5Init ;
- addq.l #4,SP ; clean up stack
-
- move.l (A5),A0 ; get pointer to start of quickdraw globals
- lea randSeed(A0),A0 ;
- move.l D5,A5 ; set A5 & get new quickdraw globals pointer
- lea QUICKDRAW.randSeed,A1
- move.l #-randSeed,D0 ; copy current globals to new area
- _BlockMove ;
- move.l (SP)+,A1 ; restore A1
- move.l D6,D0 ; return old A5 value
- return
-
- export procedure myrestorea5
- begin Save=A0-A4
- link A4,#0 ; set up frame ptr
- move.l #28,A1 ; get old A5 ptr (passed in)
- add.l A4,A1 ;
- move.l (A1),A5 ; restore old A5
- move.l uam_mem,A0 ; free the memory we allocated
- _DisposPtr ;
- unlk A4
- return
-
- end